﻿using ConfExpert.Forms.Base;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevTeam;

namespace ConfExpert.Forms.Depo.Tasinma
{
    public partial class RafSec : XForm
    {
        public string ShelfIds { get; set; }
        public RafSec()
        {
            InitializeComponent();
        }

        private void RafSec_Load(object sender, EventArgs e)
        {
            DataTable dtRaf = new DataTable();
            dtRaf.Columns.Add("ShelfId", typeof(int));

            gv.Init(dtRaf);

            DataTable dtShelf = ConfExpert.Utility.AppSession.Lookups.Shelf.Select("DepoId = 1").CopyToDataTable();
            dtShelf.Columns.Remove("TS");
            dtShelf.Columns.Remove("InsertedOn");
            dtShelf.Columns.Remove("ModifiedOn");

            gv.Columns["ShelfId"].ColumnEdit = GetCustomGLE(dtShelf, "Name", "ShelfId");

            gv.EnableNewRow();
            gv.EnableRowDelete();

            bbiTamamla.ItemClick += bbiTamamla_ItemClick;
        }

        void bbiTamamla_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gv.EndEditing();
            ShelfIds = gv.DataTable().GetValuesofSpecifiedColumn("ShelfId", ",");
            this.DialogResult = DialogResult.OK;
        }

    }
}
